


float bnot (float a) { return 1.0 - a; }
vec2  bnot ( vec2 a) { return 1.0 - a; }
vec3  bnot ( vec3 a) { return 1.0 - a; }
vec4  bnot ( vec4 a) { return 1.0 - a; }

float band (float a, float b) { return a * b; }
vec2  band ( vec2 a,  vec2 b) { return a * b; }
vec3  band ( vec3 a,  vec3 b) { return a * b; }
vec4  band ( vec4 a,  vec4 b) { return a * b; }

float bor (float a, float b) { return min(a + b, 1.0); }
vec2  bor ( vec2 a,  vec2 b) { return min(a + b, 1.0); }
vec3  bor ( vec3 a,  vec3 b) { return min(a + b, 1.0); }
vec4  bor ( vec4 a,  vec4 b) { return min(a + b, 1.0); }

float bxor (float a, float b) { return abs(a - b); }
vec2  bxor ( vec2 a,  vec2 b) { return abs(a - b); }
vec3  bxor ( vec3 a,  vec3 b) { return abs(a - b); }
vec4  bxor ( vec4 a,  vec4 b) { return abs(a - b); }

float bandn (float a, float b) { return 1.0 - a * b; }
vec2  bandn ( vec2 a,  vec2 b) { return 1.0 - a * b; }
vec3  bandn ( vec3 a,  vec3 b) { return 1.0 - a * b; }
vec4  bandn ( vec4 a,  vec4 b) { return 1.0 - a * b; }

float born (float a, float b) { return 1.0 - min(a + b, 1.0); }
vec2  born ( vec2 a,  vec2 b) { return 1.0 - min(a + b, 1.0); }
vec3  born ( vec3 a,  vec3 b) { return 1.0 - min(a + b, 1.0); }
vec4  born ( vec4 a,  vec4 b) { return 1.0 - min(a + b, 1.0); }

float bxorn (float a, float b) { return 1.0 - abs(a - b); }
vec2  bxorn ( vec2 a,  vec2 b) { return 1.0 - abs(a - b); }
vec3  bxorn ( vec3 a,  vec3 b) { return 1.0 - abs(a - b); }
vec4  bxorn ( vec4 a,  vec4 b) { return 1.0 - abs(a - b); }



float ble (float a, float b) { return float(lessThanEqual(a, b)); }
vec2  ble ( vec2 a,  vec2 b) { return  vec2(lessThanEqual(a, b)); }
vec3  ble ( vec3 a,  vec3 b) { return  vec3(lessThanEqual(a, b)); }
vec4  ble ( vec4 a,  vec4 b) { return  vec4(lessThanEqual(a, b)); }

float bgt (float a, float b) { return float(greaterThan(a, b)); }
vec2  bgt ( vec2 a,  vec2 b) { return  vec2(greaterThan(a, b)); }
vec3  bgt ( vec3 a,  vec3 b) { return  vec3(greaterThan(a, b)); }
vec4  bgt ( vec4 a,  vec4 b) { return  vec4(greaterThan(a, b)); }

float ble (float a, float b) { return float(greaterThanEqual(a, b)); }
vec2  ble ( vec2 a,  vec2 b) { return  vec2(greaterThanEqual(a, b)); }
vec3  ble ( vec3 a,  vec3 b) { return  vec3(greaterThanEqual(a, b)); }
vec4  ble ( vec4 a,  vec4 b) { return  vec4(greaterThanEqual(a, b)); }

float beq (float a, float b) { return float(equal(a, b)); }
vec2  beq ( vec2 a,  vec2 b) { return  vec2(equal(a, b)); }
vec3  beq ( vec3 a,  vec3 b) { return  vec3(equal(a, b)); }
vec4  beq ( vec4 a,  vec4 b) { return  vec4(equal(a, b)); }

float bne (float a, float b) { return float(notEqual(a, b)); }
vec2  bne ( vec2 a,  vec2 b) { return  vec2(notEqual(a, b)); }
vec3  bne ( vec3 a,  vec3 b) { return  vec3(notEqual(a, b)); }
vec4  bne ( vec4 a,  vec4 b) { return  vec4(notEqual(a, b)); }

float bany (float a, float b, float c, float d) { return float(any(vec4(a, b, c, d))); }

float banylt (float a, float b) { return float(any(lessThan(a, b))); }
float banylt ( vec2 a,  vec2 b) { return float(any(lessThan(a, b))); }
float banylt ( vec3 a,  vec3 b) { return float(any(lessThan(a, b))); }
float banylt ( vec4 a,  vec4 b) { return float(any(lessThan(a, b))); }
float balllt (float a, float b) { return float(all(lessThan(a, b))); }
float balllt ( vec2 a,  vec2 b) { return float(all(lessThan(a, b))); }
float balllt ( vec3 a,  vec3 b) { return float(all(lessThan(a, b))); }
float balllt ( vec4 a,  vec4 b) { return float(all(lessThan(a, b))); }

float banyle (float a, float b) { return float(any(lessThanEqual(a, b))); }
float banyle ( vec2 a,  vec2 b) { return float(any(lessThanEqual(a, b))); }
float banyle ( vec3 a,  vec3 b) { return float(any(lessThanEqual(a, b))); }
float banyle ( vec4 a,  vec4 b) { return float(any(lessThanEqual(a, b))); }
float ballle (float a, float b) { return float(all(lessThanEqual(a, b))); }
float ballle ( vec2 a,  vec2 b) { return float(all(lessThanEqual(a, b))); }
float ballle ( vec3 a,  vec3 b) { return float(all(lessThanEqual(a, b))); }
float ballle ( vec4 a,  vec4 b) { return float(all(lessThanEqual(a, b))); }

float banygt (float a, float b) { return float(any(greaterThan(a, b))); }
float banygt ( vec2 a,  vec2 b) { return float(any(greaterThan(a, b))); }
float banygt ( vec3 a,  vec3 b) { return float(any(greaterThan(a, b))); }
float banygt ( vec4 a,  vec4 b) { return float(any(greaterThan(a, b))); }
float ballgt (float a, float b) { return float(all(greaterThan(a, b))); }
float ballgt ( vec2 a,  vec2 b) { return float(all(greaterThan(a, b))); }
float ballgt ( vec3 a,  vec3 b) { return float(all(greaterThan(a, b))); }
float ballgt ( vec4 a,  vec4 b) { return float(all(greaterThan(a, b))); }

float banyge (float a, float b) { return float(any(greaterThanEqual(a, b))); }
float banyge ( vec2 a,  vec2 b) { return float(any(greaterThanEqual(a, b))); }
float banyge ( vec3 a,  vec3 b) { return float(any(greaterThanEqual(a, b))); }
float banyge ( vec4 a,  vec4 b) { return float(any(greaterThanEqual(a, b))); }
float ballge (float a, float b) { return float(all(greaterThanEqual(a, b))); }
float ballge ( vec2 a,  vec2 b) { return float(all(greaterThanEqual(a, b))); }
float ballge ( vec3 a,  vec3 b) { return float(all(greaterThanEqual(a, b))); }
float ballge ( vec4 a,  vec4 b) { return float(all(greaterThanEqual(a, b))); }

float banyeq (float a, float b) { return float(any(equal(a, b))); }
float banyeq ( vec2 a,  vec2 b) { return float(any(equal(a, b))); }
float banyeq ( vec3 a,  vec3 b) { return float(any(equal(a, b))); }
float banyeq ( vec4 a,  vec4 b) { return float(any(equal(a, b))); }
float balleq (float a, float b) { return float(all(equal(a, b))); }
float balleq ( vec2 a,  vec2 b) { return float(all(equal(a, b))); }
float balleq ( vec3 a,  vec3 b) { return float(all(equal(a, b))); }
float balleq ( vec4 a,  vec4 b) { return float(all(equal(a, b))); }

float banyne (float a, float b) { return float(any(notEqual(a, b))); }
float banyne ( vec2 a,  vec2 b) { return float(any(notEqual(a, b))); }
float banyne ( vec3 a,  vec3 b) { return float(any(notEqual(a, b))); }
float banyne ( vec4 a,  vec4 b) { return float(any(notEqual(a, b))); }
float ballne (float a, float b) { return float(all(notEqual(a, b))); }
float ballne ( vec2 a,  vec2 b) { return float(all(notEqual(a, b))); }
float ballne ( vec3 a,  vec3 b) { return float(all(notEqual(a, b))); }
float ballne ( vec4 a,  vec4 b) { return float(all(notEqual(a, b))); }


